/**************************************************************
 * Name:      mCore.h
 * Purpose:   mCore
 * Author:    Riku Maikola (rpm@ac-mapa.org)
 * Created:   2011-08-16
 * Copyright: Riku Maikola (rpm.ac-mapa.org)
 * License:
 **************************************************************/

#ifndef mCore_H
#define mCore_H

#define numImages 100
#define numImageBuffer 500
#define tmpBuffer 499
#define numTools  41
#define numVariables  20000

#include <wx/string.h>
#include <wx/tokenzr.h>

#include <stdlib.h>

#include "mCanvas.h"
#include "mImage.h"
#include "mNC.h"
#include "mLoad.h"
#include "mSolver.h"
#include "vertex.h"

//FREETYPE
#include <ft2build.h>
#include FT_FREETYPE_H

//****************//
//** CORE CLASS **//
//****************//
class mCore : public mSolver , public mLoad
{
private:
    double V[numVariables];
    bool updated=false;
    wxString * eptr = &SCRIPT;;  //this is echo pointer

public:
    DrawBuffer DB;

    //*********************//
    wxArrayString c_list;           //command list for syntax high light and for docs...

    //*********************//
    wxString HOME;                  //home directory
    wxString WORKDIR;


    wxString tPATH,INFO,ERR;
    wxString SCRIPT,CODE,SETUP;
    //************************************//
    mNC SIM;

    //*****************//
    int iNum = 0,tNum = 0;
    Image I[numImageBuffer];

    //*****************//
    //**  Functions  **//
    //*****************//
    mCore()
    {
        //eptr     //set default
        //Set solver
        SetSolverV(V);

        /***LOAD LIST OF COMMANDS****/
        wxTextFile code;
        if(code.Open(_("docs/Alist")))
        {
            if(code.GetFirstLine().Matches(_("LIST")))
            {
                while(!code.Eof())
                {
                    c_list.Add( code.GetNextLine() );
                }
            }
            code.Close();
        }
    };
    ~mCore()
    {
    };

    //Project
    bool Load(wxString file);               //** load project **//
    void Save(wxString file);               //** save project **//

    //Tool commands
    void LoadTool(wxString file);           //
    void SaveTool(wxString file);

    //***************************************//
    //bool ToG();                       //To G script
    bool E(wxString);                   //COMMAND LINE
    bool Names(wxString);               //gives command list to info and true or false if command is found

    void SetImageNumber(uint);
    void SetImageUp();
    void SetImageDown();

};
#endif
